package com.atomscat.lottery.controller.admin;

import com.atomscat.lottery.entity.db.LotteryUserEntity;
import com.atomscat.lottery.entity.vo.request.PageLotteryUserRequest;
import com.atomscat.lottery.entity.vo.response.BaseResponse;
import com.atomscat.lottery.service.LotteryUserService;
import com.atomscat.lottery.service.VoBaseRespTransformService;
import lombok.RequiredArgsConstructor;
import org.springframework.data.domain.Page;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/admin/lottery/user")
@RequiredArgsConstructor
public class LotteryUserController {
     private final VoBaseRespTransformService voBaseRespTransformService;
     private final LotteryUserService lotteryUserService;

     @PostMapping("/page")
     public BaseResponse<Page<LotteryUserEntity>> pageLotteryUser(@RequestBody PageLotteryUserRequest pageLotteryUserRequest) {
         return  voBaseRespTransformService.transformSuccessful(lotteryUserService.pageLotteryUserEntity(pageLotteryUserRequest));
     }

     @PostMapping("/draw/page")
     public BaseResponse<Page<LotteryUserEntity>> pageDrawLotteryUser(@RequestBody PageLotteryUserRequest pageLotteryUserRequest) {
          return  voBaseRespTransformService.transformSuccessful(lotteryUserService.pageDrawLotteryUser(pageLotteryUserRequest));
     }

}
